home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / grabthegrub.swf / scripts / __Packages / getURLManager.as next >
Encoding:
Text File  |  2007-10-01  |  1.4 KB  |  63 lines

  1. class getURLManager
  2. {
  3.    var callQueue;
  4.    var processing;
  5.    var freq;
  6.    var me;
  7.    var lastCall;
  8.    function getURLManager(frequency)
  9.    {
  10.       this.callQueue = new Array();
  11.       this.processing = false();
  12.       if(frequency == undefined)
  13.       {
  14.          this.freq = 1000;
  15.       }
  16.       this.me = this;
  17.    }
  18.    function executeCall()
  19.    {
  20.       this.lastCall = getTimer();
  21.       var _loc2_ = this.callQueue.shift();
  22.       if(_loc2_.href.indexOf("javascript") != -1 || _loc2_.win == undefined || _loc2_.win == "" || _loc2_.win == null)
  23.       {
  24.          getURL(_loc2_.href,"");
  25.       }
  26.       else
  27.       {
  28.          getURL(_loc2_.href,_loc2_.win);
  29.       }
  30.    }
  31.    function stopCalling()
  32.    {
  33.       delete this.me.onEnterFrame;
  34.       this.processing = false;
  35.    }
  36.    function startCalling()
  37.    {
  38.       if(!this.processing)
  39.       {
  40.          this.lastCall = getTimer();
  41.          this.me.onEnterFrame = function()
  42.          {
  43.             if(getTimer() - this.lastCall > this.freq)
  44.             {
  45.                this.executeCall();
  46.             }
  47.             if(this.callQueue.length < 1)
  48.             {
  49.                this.me.stopCalling();
  50.             }
  51.          };
  52.          this.processing = true;
  53.          this.executeCall();
  54.       }
  55.    }
  56.    function addToQueue(inURL, inWindow)
  57.    {
  58.       var _loc2_ = {href:inURL,win:inWindow};
  59.       this.callQueue.push(_loc2_);
  60.       this.startCalling(this.callQueue);
  61.    }
  62. }
  63.